Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

342
Vistas
Google App Script : Retrieve value of a cell that is a formula, script is returning [0.0]

I actually can't believe that I'm asking for something as simple as this, but anyway.

I have a report hub, with entries to complete, and I'd like to get everyone's number of entries left and send a Slack message. My issue here is that the values I get are simply a list of [0.0], [0.0], ect...

Here's my code :

function Values() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("Summary!B7:B28");
var data = range.getValues();


Logger.log(data)}

And the Output: [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]

the original data is something like that:

Names (ColA) Entries (ColB)
NAME1 47
NAME2 150

Note that the values of entries are actually a formula (=SUM()).

I thought I could simply retrieve the data from col B, and use an index, and then do a loop that would look like this :

function Values() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var range = sheet.getRange("Summary!B7:B28");
    var data = range.getValues();
    data.forEach(SendMessage);
    }

function SendMessage(val, index){
    var rtext = "";
    var rname = "";
    
    if(val > 0) {
     switch(index) {
      case 0: 
        rtext = "";
        rname = "";
        break;
      case 1:
        rtext = "";
        rname = "";
        break;
        default: return false;}}

// here the rest of my script to send slack messages//
}

What I found strange is the fact that even if I try to a simple =IMPORTRANGE within the sheet, for the same range, it also returns 0s. SO my main issue may be the source file.

I really hope someone can help me there, because I'm lost :)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this:

function Values() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange("Summary!B7:B28");
  var data = range.getDisplayValues();
  Logger.log(JSON.stringify(data))
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda